package cn.anlaser.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import lombok.Data;
import lombok.EqualsAndHashCode;

import org.springframework.data.domain.Persistable;
import org.springframework.data.jpa.domain.AbstractPersistable;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import cn.anlaser.status.FlagEnum;

@MappedSuperclass
@EntityListeners({ AuditingEntityListener.class })
@Data
@EqualsAndHashCode(callSuper = false)
public class SimpleEntity extends AbstractPersistable<Long> implements
		Persistable<Long> {// extends AbstractAuditable<SysUser, Long> {

	private static final long serialVersionUID = 4904357226797737962L;
	@Column(name = "SER_NO", columnDefinition = "int default 0", nullable = false)
	private int serNo;
	@Column(name = "FLAG", length = 10)
	private FlagEnum flag;

	@Column(name = "NAME")
	protected String name;
	@Column(name = "CODE")
	protected String code;

	// @ManyToOne
	private Long createdBy;

	@Temporal(TemporalType.TIMESTAMP)
	private Date createdDate;

	// @ManyToOne
	private Long lastModifiedBy;

	@Temporal(TemporalType.TIMESTAMP)
	private Date lastModifiedDate;
}
